home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 4_0 / KOSCHEKA / GETFILEM.C < prev    next >
Text File  |  1990-06-07  |  1KB  |  50 lines

  1. /********************************/
  2. /* File: FIleOpen.c                */
  3. /*                                */
  4. /* open the file whose name and */
  5. /* working directory id are     */
  6. /* passed as parameters.  This    */
  7. /* information can be obtained    */
  8. /* using GetFileNameToLoad...    */
  9. /*                                */
  10. /* Paramters:                    */
  11. /* param0 = file reference num    */
  12. /*                                */
  13. /* Out:                            */
  14. /* File RefNum if opened, 0     */
  15. /* otherwise                    */
  16. /* ----------------------------    */
  17. /********************************/
  18.  
  19. #include    <MacTypes.h>
  20. #include    <OSUtil.h>
  21. #include    <MemoryMgr.h>
  22. #include    <FileMgr.h>
  23. #include    <ResourceMgr.h>
  24. #include    <pascal.h>
  25. #include    <string.h>
  26. #include     "HyperXCmd.h"
  27. #include    "HyperUtils.h"
  28.  
  29.     
  30. pascal void main( paramPtr )
  31.     XCmdBlockPtr    paramPtr;
  32. {
  33.     Str31        str;
  34.     short        refnum;
  35.     long        fpos    = 0;
  36.     
  37.     HLock( paramPtr->params[0] );
  38.     ZeroToPas( paramPtr, *(paramPtr->params[0]), &str );
  39.     HUnlock( paramPtr->params[0] );
  40.     refnum = (short)StrToNum( paramPtr, &str );
  41.     
  42.     /*** Get the file position and return    ***/
  43.     GetFPos( refnum, &fpos );
  44.     
  45.     NumToStr( paramPtr, fpos, &str );
  46.     
  47.     paramPtr->returnValue = PasToZero( paramPtr, &str );
  48. }
  49.  
  50.